// Copyright 叶湘 ( weixin:yexiang841, email:yexiang841@qq.com ), Shitouren Studio. All Rights Reserved.

#include "Pawn/Q3D_CPPA_Pawn_Fighter.h"
#include "Property/Q3D_CPPC_PropertyState.h"
#include "Property/Q3D_CPPE_PropertyName.h"
#include "Hit/Q3D_CPPC_HitTarget.h"
#include "Engine/DataTable.h"
#include "Logger/Q3D_CPPU_Logger.h"

// Sets default values
AQ3D_CPPA_Pawn_Fighter::AQ3D_CPPA_Pawn_Fighter()
{
    this->Ptr_C_HitTarget = CreateDefaultSubobject<UQ3D_CPPC_HitTarget>(TEXT("UQ3D_CPPC_HitTarget"));
}

// Called when the game starts or when spawned
void AQ3D_CPPA_Pawn_Fighter::BeginPlay()
{
    Super::BeginPlay();

    // 基类的 BeginPlay() 会尝试调用本类的 Q3D_IF_PropertyState_InitDT_Get() 向 PropertyState 中写入初始数据
    // 但本类不打算提供数据，机会留给孙子类
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_PropertyState_InitDT_Get_Implementation(UDataTable *&ptr_dt_property_init) const
{
	// Owner 已经从外部对 Ptr_DT_PropertyInit 进行了赋值，优先级最高，直接使用
	if (this->Ptr_DT_PropertyInit)
	{
		ptr_dt_property_init = this->Ptr_DT_PropertyInit;
		Q3D_LOG(Log, "DT_Load_From_Ptr_DT_PropertyInit");
		return;
	}

	// 子类未赋值DT，则属性列表为空
	Q3D_LOG(Log, "DT_Load_Nothing");
	return;
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_Hit_Set_Implementation(UQ3D_CPPU_Hit *ptr_u_hit, bool &bool_success, FString &string_log)
{
    this->Ptr_C_HitTarget->Q3D_F_Hit_Set(ptr_u_hit, bool_success, string_log);
    return;
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_Hit_Cancel_ById_Implementation(FName name_id, bool &bool_success, FString &string_log)
{
    this->Ptr_C_HitTarget->Q3D_F_Hit_Cancel_ById(name_id, bool_success, string_log);
    return;
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_Hit_Cancel_ByType_Implementation(EQ3D_CPPE_HitType enum_hit_type, int32 &int_count)
{
    this->Ptr_C_HitTarget->Q3D_F_Hit_Cancel_ByType(enum_hit_type, int_count);
    return;
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_Hit_Cancel_ByCauser_Implementation(EQ3D_CPPE_HitType enum_hit_type, AActor *ptr_a_hit_causer, int32 &int_count)
{
    this->Ptr_C_HitTarget->Q3D_F_Hit_Cancel_ByCauser(enum_hit_type, ptr_a_hit_causer, int_count);
    return;
}

void AQ3D_CPPA_Pawn_Fighter::Q3D_IF_Hit_Cancel_All_Implementation(int32 &int_count)
{
    this->Ptr_C_HitTarget->Q3D_F_Hit_Cancel_All(int_count);
    return;
}